package com.company.book_store.web.servlet;

import com.company.book_store.pojo.Book;
import com.company.book_store.service.Bookinfoservice;
import com.company.book_store.service.BookserviceImpl;
import com.company.book_store.service.Ibookinfoservice;
import com.company.book_store.service.Ibookservice;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/updateBook")
public class updateBook extends HttpServlet {

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        int id = Integer.parseInt(req.getParameter("book_id"));
        String book_name = req.getParameter("book_name");
        String book_author = req.getParameter("book_author");
        String book_classes = req.getParameter("book_classes");
        String book_price = req.getParameter("book_price");
        String book_public = req.getParameter("book_public");
        int book_surplus = Integer.parseInt(req.getParameter("book_surplus")) ;
        Book book = new Book(id,book_name,book_author,book_classes,book_price,book_public,book_surplus);
        Ibookservice service = new BookserviceImpl();
        service.updatebook(book);

    }
}
